package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.AppUserScoreMapper;
import com.ruoyi.bizsys.domain.AppUserScore;
import com.ruoyi.bizsys.service.IAppUserScoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * app用户积分Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class AppUserScoreServiceImpl extends ServiceImpl<AppUserScoreMapper,AppUserScore> implements IAppUserScoreService {

    /**
     * 查询app用户积分
     *
     * @param id app用户积分ID
     * @return app用户积分
     */
    @Override
    public AppUserScore selectAppUserScoreById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询app用户积分列表
     *
     * @param appUserScore app用户积分
     * @return app用户积分
     */
    @Override
    public List<AppUserScore> selectAppUserScoreList(AppUserScore appUserScore) {
        return this.list(new QueryWrapper<>(appUserScore).last("order by id desc"));
    }

    /**
     * 新增app用户积分
     *
     * @param appUserScore app用户积分
     * @return 结果
     */
            @Override
    public int insertAppUserScore(AppUserScore appUserScore) {
                                                                                                                                        appUserScore.setCreateTime(DateUtils.getNowDate());
                            return baseMapper.insert(appUserScore);
    }

    /**
     * 修改app用户积分
     *
     * @param appUserScore app用户积分
     * @return 结果
     */
            @Override
    public int updateAppUserScore(AppUserScore appUserScore) {
                                                                                                                                        return baseMapper.updateById(appUserScore);
    }

    /**
     * 批量删除app用户积分
     *
     * @param ids 需要删除的app用户积分ID
     * @return 结果
     */
            @Override
    public int deleteAppUserScoreByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除app用户积分信息
     *
     * @param id app用户积分ID
     * @return 结果
     */
    @Override
    public int deleteAppUserScoreById(Long id) {
        return baseMapper.deleteById(id);
    }

}
